﻿@using Library
@model System.Data.Entity.DbSet<Library.Models.Page>

@{
    ViewBag.Title = NOWCulture.GetString("Pages");
    ViewBag.ActiveUrl = "admin/pages";
    Layout = "_Layout.cshtml";
}

<h2>@NOWCulture.GetString("Pages")</h2>
<a class="btn btn-success" href="@Url.Action("EditPage")" title="@NOWCulture.GetString("Create new")"><span class="glyphicon glyphicon-plus"></span>@NOWCulture.GetString("Create new")</a>
@using (Ajax.BeginForm("SearchPages", "Admin",
    new AjaxOptions
    {
        HttpMethod = "GET",
        AllowCache = false,
        UpdateTargetId = "pages-tbody",
        InsertionMode = InsertionMode.Replace
    }, new { @id = "search-form", @class = "pull-right col-lg-6" }))
{
    <div class="input-group">
        <input type="text" name="keywords" class="form-control" placeholder="@NOWCulture.GetString("Search for...")">
        <span class="input-group-btn">
            <button class="btn btn-default" type="submit"><span class="glyphicon glyphicon-search"></span></button>
        </span>
    </div>
}
<div class="clearfix"></div>
<div class="table-responsive">
    <table class="table table-hover" id="pages">
        <thead>
            <tr>
                <th>@NOWCulture.GetString("Name")</th>
                <th>&nbsp;</th>
            </tr>
        </thead>
        <tbody id="pages-tbody">
            @foreach (var page in Model)
            {
                @Html.Partial("_PageRow", page)
            }
        </tbody>
    </table>
</div>
@Html.Action("ConfirmDialog", "Shared", new
{
    title = NOWCulture.GetString("Remove") + " " + NOWCulture.GetString("page"),
    content = string.Format(NOWCulture.GetString("Are you sure you want to remove this {0}?"), NOWCulture.GetString("page")),
    alertTitle = NOWCulture.GetString("Oh snap! You got an error!")
})
@section scripts
{
    @(HttpContext.Current.IsDebuggingEnabled ? Scripts.Render("~/bundles/admin-pages") : Scripts.RenderFormat(@"<script src=""{0}"" async defer></script>", "~/bundles/admin-pages"))
}